package com.collect.collectclient.xml.controller;

import com.collect.collectclient.base.common.Result;
import com.collect.collectclient.xml.dto.request.SendMessageRequest;
import com.collect.collectclient.xml.dto.response.Message;
import com.collect.collectclient.xml.service.SendMessageService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.net.UnknownHostException;
import java.util.Map;

@RequestMapping("/send")
@RestController
public class MessageController {

    @Autowired
    SendMessageService sendMessageService;
    @PostMapping(value = "/message", consumes = "application/xml", produces = "application/xml")
    public Message getCpuInfo(@RequestBody SendMessageRequest request) {

        try {
            return sendMessageService.getMessageBySendMessage(request);
        } catch (UnknownHostException e) {
            throw new RuntimeException(e);
        }
    }
}
